#pragma once

#include "SocketShared.h"

class ClientSocket : public ISimpleChannel
{
    Q_OBJECT

public:
    ClientSocket(const SocketSettings& settings, const QString& name = "");
	
public:
    virtual bool       Open();
    virtual bool       IsOpened();
    virtual void       Close();
    virtual void       Reset();

    virtual unsigned   DataAvailable();
    virtual QString    LastError();
    virtual QString    Info();

    virtual QByteArray Receive(unsigned size);
    virtual unsigned   Send(const QByteArray& data);     

private:
    SocketSettings                   _settings;
    std::tr1::shared_ptr<QTcpSocket> _socket;
};